<?php $this->_extends('../_layouts/blank_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/jq.ui.css" rel="stylesheet" />
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/colorbox.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.colorbox.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.ui.js"></script>
<script type="text/javascript">
$(function(){
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$(".campaign").colorbox({width:"100%", height:"90%", iframe:true});
});
</script>
</head>
<body>
<form>
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
	From <input class="datepicker" name="begin_date" value="<?=$_GET['begin_date']?>" />
	To <input class="datepicker" name="end_date" value="<?=$_GET['end_date']?>" />
	<input type="hidden" name="medium_id" value="<?=$_GET['medium_id']?>" />
	<input type="submit" class="button" value="查询" />
</form>
<table width="100%" class="list_table">
<tr>
	<th>Source</th>
	<th>IP</th>
	<th>pv</th>
	<th>点击次数</th>
	<th>订单数</th>
	<th>订单总金额</th>
	<th>单张订单金额</th>
</tr>
<?foreach ($source as $s):?>
<?if ($s['ip'] || $s['pv'] || $s['adclicks'] || $s['order_count'] || $s['order_amount']):?>
<tr>
	<td><a class="campaign" href="<?=url('DataCenter::Marketing/ReportByDayCampaign', array('begin_date'=>$_GET['begin_date'], 'end_date'=>$_GET['end_date'], 'source_id'=>$s['id']))?>"><?=$s['name']?></a></td>
	<td><?=$s['ip']?></td>
	<td><?=$s['pv']?></td>
	<td><?=$s['adclicks']?></td>
	<td><?=$s['order_count']?></td>
	<td>$<?=number_format($s['order_amount'], 2)?></td>
	<td>$<?=($s['order_count']) ? number_format($s['order_amount']/$s['order_count'], 2) : '0.00'?></td>
</tr>
<?endif;?>
<?endforeach;?>
</table>
<?php $this->_endblock();?>